﻿using DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.RunProperties;
using DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.Types;
using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.StyleElements
{
    [XmlRoot("border", Namespace = Constants.ExcelMain)]
    public class Border : XmlSerializable
    {
        [Optional]
        [XmlAttribute("diagonalUp", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> DiagonalUp { get; set; }

        [Optional]
        [XmlAttribute("diagonalDown", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> DiagonalDown { get; set; }

        [Optional]
        [XmlAttribute("outline", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Outline { get; set; }

        [Optional]
        [XmlElement("left", Namespace = Constants.ExcelMain)]
        public BorderElement Left { get; set; }
        
        [Optional]
        [XmlElement("right", Namespace = Constants.ExcelMain)]
        public BorderElement Right { get; set; }

        [Optional]
        [XmlElement("top", Namespace = Constants.ExcelMain)]
        public BorderElement Top { get; set; }

        [Optional]
        [XmlElement("bottom", Namespace = Constants.ExcelMain)]
        public BorderElement Bottom { get; set; }

        [Optional]
        [XmlElement("diagonal", Namespace = Constants.ExcelMain)]
        public BorderElement Diagonal { get; set; }

        [Optional]
        [XmlElement("vertical", Namespace = Constants.ExcelMain)]
        public BorderElement Vertical { get; set; }

        [Optional]
        [XmlElement("horizontal", Namespace = Constants.ExcelMain)]
        public BorderElement Horizontal { get; set; }

        public Border() { }
    }

    [XmlRoot("", Namespace = Constants.ExcelMain)]
    public class BorderElement : XmlSerializable
    {
        [XmlAttribute("style", Form = XmlSchemaForm.Qualified)]
        public ST_BorderStyle BorderStyle { get; set; }

        [XmlElement("color", Namespace = Constants.ExcelMain)]
        public Color Color { get; set; }

        public BorderElement() { }
    }
}
